package com.itheima.dao;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author itheima
 * @since 2021-10-25
 */
public interface UserDao {

    /**
     * 根据手机和密码进行查询
     *
     * @param phone    手机
     * @param password 密码
     * @return 是否存在
     */
    @Select("SELECT id, phone, password FROM user WHERE phone = #{phone} AND password = #{password}")
    List<User> getByPhoneAndPassword(@Param("phone") String phone, @Param("password") String password);

    /**
     * 查询所有用户
     *
     * @return List<User>
     */
    @Select("SELECT id, phone, password FROM user")
    List<User> getAll();
}
